package com.cl.websocketboot.controller;

import com.cl.websocketboot.constant.Constant;
import org.springframework.messaging.handler.annotation.DestinationVariable;
import org.springframework.messaging.simp.annotation.SubscribeMapping;
import org.springframework.stereotype.Controller;

@Controller
public class UsersInRoomController {

    // 用户在建立连接之后，要获取到房间内所有的人
    @SubscribeMapping("/connection/{roomId}")
    public Object getUsers(@DestinationVariable("roomId") String roomId) {
        return Constant.usersInRoom.get(roomId);
    }
}
